package gef.tutorial.step.app;

import org.eclipse.ui.application.IWorkbenchConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchAdvisor;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {

	private static final String PERSPECTIVE_ID = "gef.tutorial.step.perspective"; //$NON-NLS-1$

	@Override
    public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
        return new ApplicationWorkbenchWindowAdvisor(configurer);
    }
    
	
	/**1.在工作台开始运行之前执行初始化操作。
	 *   在打开任何窗口之前，在工作台初始化期间调用此方法。
	 * 
	 */
	@Override
	public void initialize(IWorkbenchConfigurer configurer) {
		
		super.initialize(configurer);
		
		//1.1 设置应用程序每次退出时保存当前窗口状态
		configurer.setSaveAndRestore(true);
	}



	/**
	 * 2.指定工作台的初始透视图
	 */
    @Override
	public String getInitialWindowPerspectiveId() {
		return PERSPECTIVE_ID;
	}
}
